package com.zm.demo.core.leetcode;

import java.util.Stack;

class CQueue {

    Stack<Integer> s = new Stack<>();
    Stack<Integer>reverse = new Stack<>();

    public CQueue() {

    }
    
    public void appendTail(int value) {
        s.push(value);
    }
    
    public int deleteHead() {
        if (s.size() <= 0){
            return -1;
        }
        while (s.size()>0){
            reverse.push(s.pop());
        }
        int r = reverse.pop();

        while (reverse.size() > 0){
            s.push(reverse.pop());
        }        
        return r;
    }
}

/**
 * Your CQueue object will be instantiated and called as such:
 * CQueue obj = new CQueue();
 * obj.appendTail(value);
 * int param_2 = obj.deleteHead();
 */